<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <title>编码设备管理</title>
  <link rel="stylesheet" href="../bower_components/AceAdmin/assets/css/font-awesome.min.css">
  <!--[if IE 7]>
  <link rel="stylesheet" href="../bower_components/AceAdmin/assets/css/font-awesome-ie7.min.css"/>
  <![endif]-->
  <link rel="stylesheet" href="../bower_components/AceAdmin/assets/css/bootstrap.min.css">
  <link rel="stylesheet" href="../bower_components/AceAdmin/assets/css/ace.min.css">
  <!--[if lte IE 8]>
  <link rel="stylesheet" href="../bower_components/AceAdmin/assets/css/ace-ie.min.css"/>
  <![endif]-->
  <!--[if lt IE 9]>
  <script src="../bower_components/AceAdmin/assets/js/html5shiv.js"></script>
  <script src="../bower_components/AceAdmin/assets/js/respond.min.js"></script>
  <![endif]-->
  <link rel="stylesheet" href="../bower_components/layer/build/skin/default/layer.css">
  <link rel="stylesheet" href="../yjgb-css/gd_main2.min.css">
</head>
<body>
<div class="container-fluid gb_templet">
  <div class="row">
    <div class="col-xs-12">
      <button class="btn btn_green" onclick="insertRow()">
        <i class="fa fa-plus"></i>
        新增
      </button>
      <button class="btn btn_purple" onclick="updateRow('bmsbglListInput.html','ids')">
        <i class="fa fa-edit"></i>
        修改
      </button>
      <button class="btn btn_darkblue" onclick="deleteRow('bmsbglListInput.html','ids','_self')">
        <i class="fa fa-trash-o"></i>
        删除
      </button>
    </div>
  </div>
  <div class="row">
    <div class="col-xs-12">
      <table class="table table-striped table-bordered table-hover">
        <thead class="orange">
        <tr>
          <th>
            <label class="position-relative">
              <input id="ids" name="ids" value="1" type="checkbox" class="ace" />
              <span class="lbl"></span>
            </label>
          </th>
          <th>编码</th>
          <th>IP地址</th>
          <th>控制器端口</th>
          <th>数据端口</th>
          <th>传输模式</th>
        </tr>
        </thead>
        <tbody>
        <tr>
          <td class="center">
            <label class="position-relative">
              <input id="ids" name="ids" value="1" type="checkbox" class="ace" />
              <span class="lbl"></span>
            </label>
          </td>
          <td>1</td>
          <td>192.168.0.0</td>
          <td>8080</td>
          <td>8181</td>
          <td>IP模式</td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

<script src='../bower_components/AceAdmin/assets/js/jquery-1.10.2.min.js'></script>
<script type="text/javascript" src="../bower_components/AceAdmin/assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../bower_components/AceAdmin/assets/js/ace.min.js"></script>
<script type="text/javascript" src="../bower_components/AceAdmin/assets/js/ace-extra.min.js"></script>
<script type="text/javascript" src="../bower_components/layer/build/layer.js"></script>
<script type="text/javascript">

  //获取选中目标个数
  function checkNum(target){
    var cknum = 0;
    var cks = document.getElementsByName(target);
    for(var i=0;i<cks.length;i++){
      if(cks[i].checked==true){
        cknum++;
      }
    }
    return cknum;
  }

  //新增
  function insertRow() {
    var index = top.layer.open({
      skin: 'gb_layer',
      type: 2,
      title:'新增',
      shadeClose: true,
      maxmin: true,
      shade: 0.8,
      area: ['1000px', '80%'],
      btn:['保存','返回'],
      content:"bmsbglListInput.html", //iframe的url
      yes:function(){
        top.layer.alert("点击了保存按钮");
      }
    });
  }

  //修改
  function updateRow(target) {
    if(checkNum(target) < 1) {
      top.layer.alert("必须选择一行!");
      return;
    } else if (checkNum(target) > 1) {
      top.layer.alert("只能选择一行,不允许多选!");
      return;
    }
    var index=top.layer.open({
      type: 2,
      shadeClose: true,
      maxmin: true,
      shade: 0.8,
      area: ['80%', '80%'],
      btn:['保存','返回','提交'],
      content:'bmsbglListInput.html'
    });
  }

  //删除
  function deleteRow(action, target) {
    if (checkNum(target) < 1) {
      top.layer.alert("须选择一行!");
      return;
    }
    var index = top.layer.confirm("是否确定删除记录?",function(){

    });
  }






</script>
</body>
</html>